package com.sjl.service.impl;

import com.github.pagehelper.PageHelper;
import com.sjl.dao.MemberMapper;
import com.sjl.pojo.Member;
import com.sjl.pojo.SysUser;
import com.sjl.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MemberServiceImpl implements IMemberService {

    @Autowired
    private MemberMapper memberMapper;

    @Override
    public Member getMemberByUsername(String NAME) {
        return memberMapper.getMemberByUsername(NAME);
    }

    @Override
    public List<Member> getAllMembers(String NAME,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Member> allMembers = memberMapper.getAllMembers(NAME);
        return allMembers;
    }

    @Override
    public Member getMemberById(Integer id) {
        return memberMapper.getMemberById(id);
    }

    @Override
    public int addMember(Member member) {
        return memberMapper.addMember(member);
    }

    @Override
    public int editMember(Member member) {
        return memberMapper.editMember(member);
    }

    @Override
    public int deleteMemberById(Integer id) {
        return memberMapper.deleteMemberById(id);
    }

    @Override
    public int deleteAll(List<String> ids) {
        return memberMapper.deleteAll(ids);
    }
}